The Override ('over') Resource
You must provide at least one override resource, of typegxOverrideType
, for any printing extension or printer driver that you develop. This resource provides QuickDraw GX with a list of the messages that you are overriding in your extension or driver, along with the ID of the resource in which to find the code for your override's implementation. Figure 6-1 shows the structure of an override resource.Figure 6-1 The override resource
The override resource consists of a variable number of records, each of which specifies a message, a resource type, a resource ID, and an offset value. Each entry tells QuickDraw GX the name of a printing message that you are overriding and where to find the code for your override.
You need to provide separate override resources for different kinds of printing messages. There are three kinds of messages:
- Count. The number of message entries in the resource.
- Message ID. The ID of the message that you are overriding. QuickDraw GX defines an integer constant that you use here for each message. These constants are shown in Table 6-2 on page 6-15.
- Resource ID. The ID of the resource in which the code for your override can be found.
- Jump table offset. The offset into the jump table . This is the number of bytes from the beginning of the jump table to the jump instruction for your override code. The first 4 bytes in the jump table must be reserved for use by QuickDraw GX, so your first offset must be 4. You can read about the jump table in the chapter "Printing Extensions" in this book.
The ID of each override resource indicates which kind of messages are specified in the resource. Different values are used in override resources for printing extensions than are used for printer drivers, as shown in Table 6-1.
- Universal messages, used for all imaging systems.
- Imaging system messages, used for specific imaging systems. Some messages are raster imaging messages, some messages are PostScript imaging messages, and some are vector imaging messages.
- Macintosh Printing Manager messages, used to provide compatibility with the Macintosh Printing Manager interface for printing. Printing extensions cannot override Macintosh Printing Manager messages; if an extension does specify that it is overriding a Macintosh Printing Manager call, that message override is ignored.
Imaging system messages are actually separated into categories: messages for the raster imaging system, PostScript imaging system, and vector imaging system. The identifier used for each message type is shown in Table 6-2.
Listing 6-1 shows a typical override resource definition. You can also find examples of override resource definitions in Listing 2-24 on page 2-38 in the chapter "Printing Extensions" and in Listing 3-20 on page 3-56 in the chapter "Printer Drivers."
Listing 6-1 An example of an override resource
#define mySegment 0 #define firstOffset 4 resource gxOverrideType (gxExtensionUniversalOverrideID, sysHeap, purgeable) { { /* message to override segmentID jump table offset */ gxInitialize, mySegment, firstOffset+0, gxShutDown, mySegment, firstOffset+4, gxJobPrintDialog, mySegment, firstOffset+8, gxHandlePanelEvent, mySegment, firstOffset+12, gxDespoolPage, mySegment, firstOffset+16 }; };This resource specifies the universal messages that an extension is overriding. In this case, five messages are being overridden. Each of these messages is found in a code segment with a resource ID ofmySegment
. The jump ('JMP'
) statement for thegxInitialize
message is found at the first offset (4 bytes) from the start of the jump table, and the jump statements for the subsequent messages are each located 4 bytes apart.
- IMPORTANT
- Each jump table entry is 4 bytes long, and QuickDraw GX reserves the first 4 bytes in the table for its own use. This means that your first jump table entry must be located at an offset of 4 bytes from the beginning of the table. For this reason, the
firstOffset
constant in Listing 6-1 is defined with a value of 4.![]()
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help